<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>选择器 | Introduction</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../css/伪类.html" />
    
    
    <link rel="prev" href="../css/CSS语法.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="2.2"
        data-chapter-title="选择器"
        data-filepath="css/选择器.md"
        data-basepath=".."
        data-revision="Wed Apr 18 2018 23:41:29 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="html.html">
            
            <span><b>1.</b> HTML</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="html/html的基本结构和内容.html">
            
                
                    <a href="../html/html的基本结构和内容.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        HTML
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="html/a-标签.html">
            
                
                    <a href="../html/a-标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a-标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="html/img.html">
            
                
                    <a href="../html/img.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        img-标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="html/biaoge.html">
            
                
                    <a href="../html/biaoge.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        table-表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="html/列表与表单.html">
            
                
                    <a href="../html/列表与表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        列表与表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="html/音频和视频-标签.html">
            
                
                    <a href="../html/音频和视频-标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        音频与视频
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="html/iframe内嵌框架.html">
            
                
                    <a href="../html/iframe内嵌框架.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        iframe内嵌框架
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="CSS.html">
            
            <span><b>2.</b> CSS</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="css/CSS语法.html">
            
                
                    <a href="../css/CSS语法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        CSS基本语法
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="2.2" data-path="css/选择器.html">
            
                
                    <a href="../css/选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="css/伪类.html">
            
                
                    <a href="../css/伪类.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        伪类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="css/盒子模型.html">
            
                
                    <a href="../css/盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="css/字体.html">
            
                
                    <a href="../css/字体.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        字体
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="css/行高.html">
            
                
                    <a href="../css/行高.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        行高
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >Introduction</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <p><img src="../img/123.png" alt="&#x56FE;&#x7247;"></p>
<h1 id="welcome-to-my-xtnotebook">Welcome to My XT-Notebook</h1>
<h2 id="&#x9009;&#x62E9;&#x5668;">&#x9009;&#x62E9;&#x5668;</h2>
<h3 id="1&#x5E38;&#x7528;&#x7684;&#x9009;&#x62E9;&#x5668;">1.&#x5E38;&#x7528;&#x7684;&#x9009;&#x62E9;&#x5668;</h3>
<table>
<thead>
<tr>
<th style="text-align:center">&#x7C7B;</th>
<th style="text-align:center">&#x5C5E;&#x6027;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">&#x901A;&#x914D;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">*&#x53F7;&#x4EE3;&#x8868;&#x6240;&#x6709;&#x5143;&#x7D20;&#xFF0C;&#x4E00;&#x822C;&#x91CD;&#x7F6E;&#x6837;&#x5F0F;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x5C06;&#x6D4F;&#x89C8;&#x5668;&#x81EA;&#x5E26;&#x7684;&#x6837;&#x5F0F;&#x8986;&#x76D6;</td>
</tr>
<tr>
<td style="text-align:center">&#x5143;&#x7D20;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">&#x6807;&#x7B7E;&#x540D;{}&#xFF0C;&#x6240;&#x6709;&#x6807;&#x7B7E;&#x4E5F;&#x4F1A;&#x6709;&#x540C;&#x6837;&#x7684;&#x6837;&#x5F0F;</td>
</tr>
<tr>
<td style="text-align:center">&#x7FA4;&#x7EC4;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">&#x4EE5;,&#x9694;&#x5F00;&#x5176;&#x4ED6;&#x9009;&#x62E9;&#x5668;</td>
</tr>
<tr>
<td style="text-align:center">id&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">#&#x8868;&#x793A;id&#xFF0C;id&#x8981;&#x552F;&#x4E00;</td>
</tr>
<tr>
<td style="text-align:center">&#x7C7B;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">.&#x4EE3;&#x8868;class</td>
</tr>
</tbody>
</table>
<h3 id="2&#x57FA;&#x672C;&#x6837;&#x5F0F;">2.&#x57FA;&#x672C;&#x6837;&#x5F0F;</h3>
<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;title&gt;&lt;/title&gt;

        &lt;style type=&quot;text/css&quot;&gt;

        /*
         * &#x901A;&#x914D;&#x9009;&#x62E9;&#x5668;
         *         *&#x53F7;&#x4EE3;&#x8868;&#x6240;&#x6709;&#x5143;&#x7D20; 
         * &#x4E00;&#x822C;&#x91CD;&#x7F6E;&#x6837;&#x5F0F;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x5C06;&#x6D4F;&#x89C8;&#x5668;&#x81EA;&#x5E26;&#x7684;&#x6837;&#x5F0F;&#x8986;&#x76D6;        
         * */


        *{
            margin:0px;
            padding: 0px;
            list-style: none;
        }
        /*
             &#x5143;&#x7D20;&#x9009;&#x62E9;&#x5668;
                 &#x6807;&#x7B7E;&#x540D;{}

             &#x6240;&#x6709;&#x6807;&#x7B7E;&#x4E5F;&#x4F1A;&#x6709;&#x540C;&#x6837;&#x7684;&#x6837;&#x5F0F;

         * */
            div{
                background:skyblue;
            }
            /*
                     &#x7FA4;&#x7EC4;&#x9009;&#x62E9;&#x5668;
                         &#x4EE5;,&#x9694;&#x5F00;&#x5176;&#x4ED6;&#x9009;&#x62E9;&#x5668;
             * */
            div,a{
                font-size: 20px;
            }

            /*
                 id&#x9009;&#x62E9;&#x5668;
                     #&#x8868;&#x793A;id
                 id&#x8981;&#x552F;&#x4E00;
             * */
            #two{
                color:gray;
            }

            /*
                 &#x7C7B;&#x9009;&#x62E9;&#x5668;
                     .&#x4EE3;&#x8868;class
             * */
            .son{
                font-weight:bold;
            }
        &lt;/style&gt;


    &lt;/head&gt;
    &lt;body&gt;

        &lt;div&gt;
            &#x9009;&#x62E9;&#x5668;1
        &lt;/div&gt;
        &lt;div id=&quot;two&quot; class=&quot;son&quot;&gt;
            &#x9009;&#x62E9;&#x5668;2
        &lt;/div&gt;
        &lt;div class=&quot;son &quot;&gt;
            &#x9009;&#x62E9;&#x5668;3
        &lt;/div&gt;

    &lt;/body&gt;
&lt;/html&gt;
</code></pre><h2 id="&#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;">&#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;</h2>
<h3 id="1&#x57FA;&#x672C;&#x5185;&#x5BB9;">1.&#x57FA;&#x672C;&#x5185;&#x5BB9;</h3>
<table>
<thead>
<tr>
<th style="text-align:center">&#x7C7B;</th>
<th style="text-align:center">&#x5C5E;&#x6027;</th>
<th>&#x7ED3;&#x6784;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">&#x540E;&#x4EE3;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">&#x53EA;&#x8981;div&#x91CC;&#x9762;&#x5305;&#x542B;a&#xFF0C;&#x4E0D;&#x7BA1;&#x4E2D;&#x95F4;&#x7ECF;&#x8FC7;&#x591A;&#x5C11;&#x5C42;&#x7ED3;&#x6784;&#xFF0C;&#x4E5F;&#x80FD;&#x88AB;&#x9009;&#x4E2D;</td>
<td>a b</td>
</tr>
<tr>
<td style="text-align:center">&#x5B50;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">&#x53EA;&#x4F1A;&#x9009;&#x4E2D;&#x76F4;&#x5C5E;&#x513F;&#x5B50;&#x5143;&#x7D20;</td>
<td>a&gt;b</td>
</tr>
<tr>
<td style="text-align:center">&#x76F8;&#x90BB;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">&#x7D27;&#x63A5;a&#x5143;&#x7D20;&#x7684;b&#x5143;&#x7D20;(a&#x7684;&#x540E;&#x4E00;&#x4E2A;)</td>
<td>a+b</td>
</tr>
<tr>
<td style="text-align:center">&#x5144;&#x5F1F;&#x9009;&#x62E9;&#x5668;</td>
<td style="text-align:center">&#x63A7;&#x5236;&#x540E;&#x9762;&#x7684;&#x5144;&#x5F1F;</td>
<td>a~b</td>
</tr>
</tbody>
</table>
<h3 id="2&#x57FA;&#x672C;&#x7ED3;&#x6784;">2.&#x57FA;&#x672C;&#x7ED3;&#x6784;</h3>
<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;title&gt;&#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;&lt;/title&gt;
        &lt;style type=&quot;text/css&quot;&gt;
            /*
                 &#x540E;&#x4EE3;&#x9009;&#x62E9;&#x5668;
                     &#x53EA;&#x8981;div&#x91CC;&#x9762;&#x5305;&#x542B;a&#xFF0C;&#x4E0D;&#x7BA1;&#x4E2D;&#x95F4;&#x7ECF;&#x8FC7;&#x591A;&#x5C11;&#x5C42;&#x7ED3;&#x6784;&#xFF0C;&#x4E5F;&#x80FD;&#x88AB;&#x9009;&#x4E2D;

             * */
            div a{
                color: skyblue;
            }
            /*
                 &#x5B50;&#x9009;&#x62E9;&#x5668;
                     &#x53EA;&#x4F1A;&#x9009;&#x4E2D;&#x76F4;&#x5C5E;&#x513F;&#x5B50;&#x5143;&#x7D20;
             * */
            div&gt;a{
                background: #0000FF;
            }
            p{
                background: #0000FF;
            }

            /*
                 &#x76F8;&#x90BB;&#x9009;&#x62E9;&#x5668;
                     a+b     &#x7D27;&#x63A5;a&#x5143;&#x7D20;&#x7684;b&#x5143;&#x7D20;(a&#x7684;&#x540E;&#x4E00;&#x4E2A;)

             * */
            #p2+p{
                background:#808080;
            }

            /*
                 &#x5144;&#x5F1F;&#x9009;&#x62E9;&#x5668;
                     a~b     &#x63A7;&#x5236;&#x540E;&#x9762;&#x7684;&#x5144;&#x5F1F;
             * */

            #p2~p{
                color: orange;
            }

            /* css&#x8BFB;&#x53D6;&#x540E;&#x7684;&#x5BFB;&#x627E;&#x5143;&#x7D20;&#x89C4;&#x5F8B;&#x662F;&#x4ECE;&#x5C0F;&#x5230;&#x5927;*/
            /* &#x7B2C;&#x4E00;&#x4E2A;&#x6027;&#x80FD;&#x597D;&#x7684;&#x539F;&#x56E0;&#x662F;&#xFF0C;&#x5148;&#x627E;&#x5230;&#x552F;&#x4E00;&#x7684;id&#xFF0C;&#x8981;&#x4E48;&#x7B26;&#x5408;&#x6761;&#x4EF6;&#xFF0C;&#x8981;&#x4E48;&#x627E;&#x4E0D;&#x5230; */
            .div #app
            /* &#x5148;&#x627E;&#x5230;&#x7C7B;&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x5B58;&#x5728;&#x591A;&#x4E2A;&#x7C7B;&#xFF0C;&#x67E5;&#x8BE2;&#x6B21;&#x6570;&#x53EF;&#x80FD;&#x591A;&#x4E8E;&#x524D;&#x8005;     */
            #app .div

        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div&gt;
            &lt;a&gt;&#x80CC;&#x666F;&#x8272;&#x662F;#E61061&lt;/a&gt;
            &lt;span&gt;
                &lt;a&gt;&#x80CC;&#x666F;&#x8272;&#x662F;#67B374&lt;/a&gt;
            &lt;/span&gt;
            &lt;div&gt;
                &lt;a&gt;&#x513F;&#x5B50;a&lt;/a&gt;
            &lt;/div&gt;
            &lt;div&gt;
                &lt;div&gt;
                    &lt;a&gt;&#x5B59;&#x5B50;&lt;/a&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;p&gt;&#x80CC;&#x666F;&#x8272;&#x662F;#0000FF&lt;/p&gt;
        &lt;p id=&quot;p2&quot;&gt;&#x80CC;&#x666F;&#x8272;&#x662F;#808080&lt;/p&gt;
        &lt;p &gt;&#x80CC;&#x666F;&#x8272;&#x662F;#808080&lt;/p&gt;
        &lt;p &gt;&#x80CC;&#x666F;&#x8272;&#x662F;#808080&lt;/p&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../css/CSS语法.html" class="navigation navigation-prev " aria-label="Previous page: CSS基本语法"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../css/伪类.html" class="navigation navigation-next " aria-label="Next page: 伪类"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
